package com.markerhub.views;

import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.markerhub.entity.Comment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

@Data
public class CommentView {
    private static final long serialVersionUID = 1L;

    private Integer commentId;

    private Integer uid;

    /**
     * 评论内容
     */
    private String content;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    private Integer blogId;

    private Integer parentCommentId;

    private String nickname;

    private String avatar;

    private List<CommentView> children;

    public CommentView(Comment comment){
        this.commentId=comment.getCommentId();
        this.uid=comment.getUid();
        this.content=comment.getContent();
        this.createTime=comment.getCreateTime();
        this.blogId=comment.getBlogId();
        this.parentCommentId=comment.getParentCommentId();
        this.nickname=comment.getNickname();
        this.avatar=comment.getAvatar();
    }
}
